Vpa.Source = function(fileName){
    this.snappets = [];
    this.name = fileName.replace(/[^\/]*\//,"").replace(/\.js$/,"").replace(/\//g,"-")+".html";
};
Vpa.Source.prototype = {
    addText : function(textSnappets){
        this.snappets = textSnappets;
    },
    getOutputText : function(){
        var sns = this.snappets,
            str = "";
        for(var i=1,len=sns.length;i<len;i++){
            var anchor = '/**\n',
                pre = sns[i-1],
                ch = '';
            pre.length -= 3;
            if(pre.length)
                ch = pre[pre.length-1];
            while(pre.length && (' ' == ch || '\t'== ch)){
                /*
                if(' ' == ch)
                    anchor = ' '+anchor;
                else if('\t' == ch)
                    anchor = '    '+anchor;
                    */
                pre.length--;
                if(pre.length)
                    ch = pre[pre.length-1];
            }
            
            var lines = sns[i].join('').split('\n');
            while(lines.length){
                var line = lines[0].trim();
                if(line.length)
                    break;
                else
                    lines.shift();
            }
            str += '<span id="vespa-'+i+'">'+anchor+'</span>';
            str += lines.join('\n').replace(/\/\*\*$/,'').replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
            
        }
        if(sns.length)
            str = sns[0].join('').replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;")+str;
        
        return str;
    }
};
